package de.fhaugsburg.games.boardgames.scrabble;

import de.fhaugsburg.games.boardgames.GridPoint;

public enum ManhattanDirection {
	DOWN(1,0),UP(-1,0),RIGHT(0,1),LEFT(0,-1);
	
	public GridPoint gridPoint;
	
	private ManhattanDirection(int row, int col) {
		gridPoint = new GridPoint(row,col);
	}
	public static ManhattanDirection calcDir(GridPoint a, GridPoint b){
		if(a.compareTo(b) == 1)
			return LEFT;
		else if(a.compareTo(b) == -1)
			return DOWN;
		else if(a.minus(b).col > 0 && a.minus(b).row == 0)
			return RIGHT;
		else if(a.minus(b).row > 0 && a.minus(b).col == 0)
			return UP;
		return null;
	}
	
	public ManhattanDirection orthogonalDir(){
		switch (this) {
		case DOWN:
			return UP;
		case UP:
			return DOWN;
		case RIGHT:
			return LEFT;
		case LEFT:
			return RIGHT;

		default:
			break;
		}
		return null;
	}

}

